import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 晓星航
 * Date: 2023-08-08
 * Time: 0:31
 */
public class IODemo4 {
    //进行写文件
    public static void main(String[] args) throws IOException {
//        OutputStream outputStream = null;
//        try {
//            outputStream = new FileOutputStream("d:/test.txt");
//            outputStream.write(97);
//            outputStream.write(98);
//            outputStream.write(99);
//            outputStream.write(100);
//
//        } finally {
//            outputStream.close();
//        }
        try (OutputStream outputStream = new FileOutputStream("d:/test.txt")) {
            outputStream.write(97);
            outputStream.write(98);
            outputStream.write(99);
            outputStream.write(100);
        }
    }

}
